package com.leonzhangxf.guava.eventbus;

import com.google.common.eventbus.EventBus;


/**
 * Guava event bus use demo.
 *
 * @author leonzhangxf 20190219
 */
public class EventBusApplication {

    public static void main(String[] args) {
        EventBus eventBus = new EventBus();

        PrintEventListener printEventListener = new PrintEventListener("listener 1");
        eventBus.register(printEventListener);

        PrintEvent printEvent = new PrintEventImp();
        eventBus.post(printEvent);

        PrintEvent printEvent2 = new PrintEventImp2();
        eventBus.post(printEvent2);

        BadEvent badEvent = new BadEvent();
        eventBus.post(badEvent);
    }
}
